<!DOCTYPE html>
<meta charset="utf-8">
<script src="./d3-cloud-master/lib/d3/d3.js"></script>
<script src="./d3-cloud-master/d3.layout.cloud.js"></script>
<body>
<script>
  var fill = d3.scale.category20();

  d3.layout.cloud().size([300, 300])
      .words([
        <!-- "Hello", "world", "normally", "you", "want", "more", "words",
        "than", "this"-->].map(function(d) {
        return {text: d, size: 10 + Math.random() * 90};
      }))
      .rotate(function() { return ~~(Math.random() * 2) * 90; })
      .font("Impact")
      .fontSize(function(d) { return d.size; })
      .on("end", draw)
      .start();

  function draw(words) {
    d3.select("body").append("svg")
        .attr("width", 300)
        .attr("height", 300)
      .append("g")
        .attr("transform", "translate(150,150)")
      .selectAll("text")
        .data(words)
      .enter().append("text")
        .style("font-size", function(d) { return d.size + "px"; })
        .style("font-family", "Impact")
        .style("fill", function(d, i) { return fill(i); })
        .attr("text-anchor", "middle")
        .attr("transform", function(d) {
          return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";
        })
        .text(function(d) { return d.text; });
  }
</script>
<form action="./Subredditcloud" method="get">
	<!-- errors go here -->
	<br>
	Enter subreddit name
	<br>
	<textarea name="subreddit" rows="1" cols="20"></textarea>
	<br>
	<input type="submit" value="Generate wordcloud for subreddit">
</form>
<h5 align='right'>The repository for this site and webapps is on 
		<a href='https://code.google.com/p/my-web-apps/'>Google code</a>. Feel free to hack away!</h5>
<h5 align='right'>This application uses a slightly modified version of 
<a href="https://praw.readthedocs.org/en/latest/">PRAW</a> to access Reddit, 
and <a href="https://github.com/jasondavies/d3-cloud">d3-cloud</a> to generate word clouds. </h5>
</body>
